package com.jgame.secondarymarket.application.service.product;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.jgame.secondarymarket.domain.product.entity.Product;
import com.jgame.secondarymarket.domain.product.service.ProductService;
import com.jgame.secondarymarket.interfaces.query.page.product.PageProductQuery;

import com.jgame.secondarymarket.interfaces.query.product.UpdateProductQuery;
import com.jgame.secondarymarket.interfaces.vo.product.ProductVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * @title: ProductApplicationService
 * @Author Wangsj
 * @Date: 2021/7/21
 */
@Service
@Transactional
@Slf4j
public class ProductApplicationService {

    @Autowired
    ProductService productService;

    public void save(Product product) {
        productService.saveProduct(product);
    }

    public void update(UpdateProductQuery query, Long productId) {
        productService.update(query, productId);
    }

    public ProductVO findById(Long productId) {
        return productService.findById(productId);
    }

    public IPage<ProductVO> getPage(PageProductQuery query) {
        return productService.pageProduc(query);
    }

    public void delById(Long productId) {
        productService.delById(productId);
    }
}
